package crawler;

public class CTSPipe extends Pipe {
	
	public CTSPipe() {
		super();
	}
	
	
	public synchronized void sendPendindgWebs(NVQueue<String> _pendingWebs) {
		pendingWebs = _pendingWebs;
		while (full) {
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	
		full = true;
		request = false;
		notify();
	}
	
	public synchronized NVQueue<String> receivePendingWebs() {
		while (!full || request) {
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		full = false;
		request = true;
		notify();
		return pendingWebs;
	}

}
